<template name="RosterListModal">
  <div class="modal fade full-screen">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-label="Close">&times;</button>
          <h4 class="modal-title">{{_ 'users_list'}}</h4>
        </div>
        <div class="modal-body scroll-box no-padding">
          <ul class="list-group threads">
            {{#each users}}
              <li class="list-group-item clearfix thread" id="{{_id}}">
                <div class="pull-right">
                  <a href="#" class="btn-edit-roster text-muted action"><i class="fa fa-edit"></i> {{_ 'app_action_edit'}}</a>
                </div>
                <div class="thread-icon">
                  {{> avatar user=this shape="circle" class="" size="small"}}
                </div>
                <div class="thread-title">
                  <div class="thread-subject">{{name}} <small class="text-muted">&nbsp;{{title}}</small></div>
                  <div class="message-summary text-ellipsis text-muted">{{email}}</div>
                </div>
              </li>
            {{/each}}
          </ul>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">{{_ 'app_action_discard'}}</button>
          <a href="#" id="btn-add-roster" class="btn btn-primary">{{_ "users_action_new"}}</a>
        </div>
      </div>
    </div>
  </div>
</template>

<template name="AddRosterModal">
  <div class="modal fade modal-rounded">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-label="Close">&times;</button>
          <h4 class="modal-title">{{_ 'users_action_new'}}</h4>
        </div>
        {{#autoForm collection=formCollection schema=formSchema id="add-roster-form" type="normal"}}
          <div class="modal-body">
            {{> afQuickField name="name"}}
            {{> afQuickField name="email" domain=domain}}
            {{> afQuickField name="password"}}
            {{> afQuickField name="title"}}
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">{{_ 'app_action_discard'}}</button>
            <button type="submit" class="btn btn-primary">{{_ "app_action_save"}}</button>
          </div>
        {{/autoForm}}
      </div>
    </div>
  </div>
</template>

<template name="EditRosterModal">
  <div class="modal fade modal-rounded">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-label="Close">&times;</button>
          <h4 class="modal-title">{{_ 'users_action_edit'}}</h4>
        </div>
        <div class="modal-body">
          {{#autoForm collection=formCollection schema=formSchema doc=this id="edit-roster-form" type="normal"}}
            {{> afQuickField name="name" value=name}}
            {{> afQuickField name="email" domain=domain value=email}}
            {{> afQuickField name="password"}}
            {{> afQuickField name="title" value=title}}
            <button type="submit" class="btn btn-primary">{{_ 'app_action_save'}}</button>
            <button type="button" class="btn btn-default" data-dismiss="modal">{{_ 'app_action_discard'}}</button>
          {{/autoForm}}
        </div>
      </div>
    </div>
  </div>
</template>

<template name="EditContactModal">
  <div class="modal fade full-screen">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-label="Close">&times;</button>
          <h4 class="modal-title">{{_ 'users_action_edit_contact'}}</h4>
        </div>
        {{#autoForm collection=formCollection schema=formSchema doc=this id="edit-contact-form" type="normal"}}
          <div class="modal-body scroll-box">
            {{> afQuickField name="name" value=name}}
            {{> afQuickField name="email" value=email}}
            {{> afQuickField name="title" value=profile.title}}
            {{> afQuickField name="company" value=profile.company}}
            {{> afQuickField name="noreply" value=profile.noreply}}
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">{{_ 'app_action_discard'}}</button>
            <button type="submit" class="btn btn-primary">{{_ 'app_action_save'}}</button>
          </div>
        {{/autoForm}}
      </div>
    </div>
  </div>
</template>

<template name="UserCardModal">
  <div class="modal fade full-screen">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-label="Close">&times;</button>
          <h4 class="modal-title">{{_ "users_user_info"}}</h4>
        </div>
        <div class="modal-body scroll-box">
          <div class="box box-widget widget-user-2">
            <!-- Add the bg color to the header using any of the bg-* classes -->
            <div class="widget-user-header bg-yellow clearfix">
              {{> avatar user=this shape="circle" class="img-circle pull-left" size="large"}}
                <!-- /.widget-user-image -->
              <h3 class="widget-user-username">{{name}}</h3>
              <h5 class="widget-user-desc">{{profile.message}}</h5>
            </div>
            <div class="box-footer no-padding">
              <ul class="nav nav-stacked">
                {{#with title}}<li><a class="text-muted text-ellipsis">{{_ 'profile_title'}} <span class="pull-right">{{this}}</span></a></li>{{/with}}
                <li><a class="text-muted text-ellipsis">{{_ 'Email'}} <span class="pull-right">{{email}}</span></a></li>
                <li>
                  {{#LinkToUserShared user=this class="text-muted text-ellipsis"}}
                    {{_ 'share_title'}}
                    <span class="pull-right text-muted"><i class="fa fa-chevron-right"></i></span>
                  {{/LinkToUserShared}}
                </li>
              </ul>
            </div>
          </div>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal" aria-label="Close">{{_ "app_action_close"}}</button>
          {{> LinkToChat roster=this}}
        </div>
      </div>
    </div>
  </div>
</template>

<template name="ContactCardModal">
  <div class="modal fade full-screen">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-label="Close">&times;</button>
          <h4 class="modal-title">{{_ "users_contact_info"}}</h4>
        </div>
        <div class="modal-body scroll-box">
          <div class="box box-widget widget-user-2">
            <!-- Add the bg color to the header using any of the bg-* classes -->
            <div class="widget-user-header bg-green clearfix">
              {{> avatar user=this shape="circle" class="img-circle pull-left" size="large"}}
                <!-- /.widget-user-image -->
              <h3 class="widget-user-username">{{name}}</h3>
              <h5 class="widget-user-desc">{{profile.company}}</h5>
            </div>
            <div class="box-footer no-padding">
              <ul class="nav nav-stacked">
                {{#with title}}<li><a class="text-muted text-ellipsis">{{_ 'profile_title'}} <span class="pull-right">{{this}}</span></a></li>{{/with}}
                <li><a class="text-muted text-ellipsis">{{_ 'Email'}} <span class="pull-right">{{email}}</span></a></li>
              </ul>
            </div>
          </div>
        </div>
        <div class="modal-footer">
          {{#LinkToEditContact contact=this class="pull-left btn btn-default"}}
            {{_ "app_action_edit"}}
          {{/LinkToEditContact}}
          <button type="button" class="btn btn-default" data-dismiss="modal" aria-label="Close">{{_ "app_action_close"}}</button>
          {{#unless noreply}}
            {{> LinkToChat roster=this}}
          {{/unless}}
        </div>
      </div>
    </div>
  </div>
</template>
